﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Linq;
using System.Web;

namespace LS.Models
{

    public class MemberCardContext : DbContext
    {
        public MemberCardContext()
            : base("DefaultConnection")
        {
        }

        public DbSet<MemberCard> MemberCards { get; set; }

        public DbSet<Card> Cards { get; set; }

        public DbSet<Member> Members { get; set; }

    }
    [Table("MemberCard")]
    public class MemberCard
    {
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int Id { get; set; }

        [ForeignKey("RelatedCard")]
        public int CardId { get; set; }
        public virtual Card RelatedCard { get; set; }

        [ForeignKey("RelatedMember")]
        public int MemberId { get; set; }
        public virtual Member RelatedMember { get; set; }

        public DateTime ExpireDate { get; set; }

        public string Description { get; set; }

        public string ImageUrl { get; set; }
    }
    public class CardManageModel 
    {
        public int MemberCardId { get; set; }
        public Card Card { get; set; }

        public string Description { get; set; }

        [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:yyyy-MM-dd}")]        
        public DateTime ExpireDate { get; set; }

        public Status Status { get; set; }
    }

    public class MemberCardModel
    {
    }
}